package com.blb.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blb.entity.IomWarehouse;
import com.blb.entity.Product;
import com.blb.entity.page.BlbPage;
import com.blb.entity.page.DataTablePage;
import com.blb.service.IIomWarehouseService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author PangLei
 * @since 2019-11-21
 */
@Controller
@RequestMapping("/iomWarehouse")
public class IomWarehouseController {

    @Resource
    private IIomWarehouseService iomWarehouseService;

    @ResponseBody
    @PostMapping("page")
    public BlbPage page(String iomNo , int start, int length){

        //查询分页数据
        IPage page = iomWarehouseService.page(new Page(start, length),new QueryWrapper<IomWarehouse>().eq("iom_no",iomNo));

        //查询总条数
        int count = iomWarehouseService.count(new QueryWrapper<IomWarehouse>().eq("iom_no",iomNo));

        return new DataTablePage(count, count, page.getRecords());
    }
}

